<?php
/**
 * Author: Administrator
 * Date: 2022/8/3 1:40
 */

namespace DesignPatterns\Behavioral\Specification;


class Both extends AbstractSpecification
{
    protected $a;
    protected $b;
    public function __construct(SpecificationInterface $a, SpecificationInterface $b)
    {
        $this->a = $a;
        $this->b = $b;
    }

    public function isSatisfiedBy(Item $item)
    {
        return $this->a->isSatisfiedBy($item) && $this->b->isSatisfiedBy($item);
    }
}